package org.sixdog.mcsit.utils;

import javax.xml.crypto.Data;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;

public class TimeUtils {
    //生成一个日期时间对象
    public static Date buildTime(int year, int month, int date, int hour, int min, int sec){
        Calendar c = Calendar.getInstance();
        c.set(year,month-1,date,hour,min,sec);
        c.set(Calendar.MILLISECOND, 0);
        return c.getTime();
    }
    public static Date buildTime(int year,int month,int date){
        return buildTime(year, month, date,0,0,0);
    }
    public static String longToDate(long lo){
        Date date = new Date(lo);
        SimpleDateFormat sd = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sd.format(date);
    }

}
